<template>
  <div>
    <z-table ref="table" rowKey="id" :showAlert="false" :showSelection="false" :loading="loading" :columns="columns"
             :dataSource="pageData" @change="onTableChange">

    </z-table>
  </div>
</template>

<script>
/*Statistic
变更执行地
 */
export default {
  data(){
    return {
      pageData:undefined,
      loading: false,
      columns: [
        {
          title: '序号',
          dataIndex: 'order',
          width: 60,
          align: 'center',
          customRender: (text, record, index) =>
            `${(this.pageFilter.pageNo - 1) * this.pageFilter.pageSize + (index + 1)}` //序号分页后连续
        },
        {
          title: '门诊地区',
          dataIndex: 'clinicRegion',
          align: 'center',
          // customRender: (text) => {
          //   return <j-ellipsis value={text} length={14} />
          // },
        },
        {
          title: '门诊编号',
          dataIndex: 'clinicId',
          align: 'center',
        },
        {
          title: '服药次数',
          dataIndex: 'takeCureCount',
          align: 'center',
        },
        {
          title: '服药时间',
          dataIndex: 'takeMedicineTime',
          align: 'center',
        },
        {
          title: '药物批号',
          dataIndex: 'cureId',
          align: 'center',
        },
        {
          title: '当前剂量',
          dataIndex: 'dose',
          align: 'center',
        },
        {
          title: '备选药物批号',
          dataIndex: 'spareCureId',
          align: 'center',
        },
        {
          title: '备选当前剂量',
          dataIndex: 'spareDose',
          align: 'center',
        },
        {
          title: '医生编号',
          dataIndex: 'doctorId',
          align: 'center',
        },
      ],
      pageFilter: {
        pageNo: 1,
        pageSize: 10
      },
    }
  },
  methods:{
    onSelectedRow(keys) {
      this.selectKeys = keys
      this.isDisabled = keys.length > 0 ? false : true
    },
    onTableChange(pagination, pageFilter, sorter) {
      let keyMap = { currentPage: 'pageNo' }
      let paginations = Object.keys(pagination).reduce((newData, key) => {
        let newKey = keyMap[key] || key
        newData[newKey] = pagination[key]
        return newData
      }, {})
      this.pageFilter = Object.assign({}, this.pageFilter, paginations)
      this.refreshTable()
    },

  }
}
</script>

<style scoped>

</style>